﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.IO;

namespace Sys.WebRes.Data
{
    public class SysConfig
    {
        public static string HostUrl { get; set; }

        public static string UploadFolder { get; set; }
        public static string UploadPictureFolder { get; set; }
        public static string UploadMediaFolder { get; set; }
        public static string UploadFileFolder { get; set; }

        public static string DefaultPicture { get; set; }

        public static bool   RenameUploadFile { get; set; }
        public static string UploadFileNameFormat { get; set; }
        public static string UploadFolderNameFormat { get; set; }
        public static string ThumbPrefix { get; set; }
        public static int ThumbWidth { get; set; }

        static SysConfig()
        {
            HostUrl = "/";
            UploadFolder = "Uploads";
            UploadPictureFolder = "Pic";
            UploadMediaFolder = "Media";
            UploadFileFolder = "File";
            DefaultPicture = "noimage.gif";
            RenameUploadFile = true;
            UploadFileNameFormat = "yyyyMMddhhmmssfff";
            UploadFolderNameFormat = "yyyy-MM";
            ThumbPrefix = "thumb_";
            ThumbWidth = 100;
        }

        public static void Initialize(ResourceSysEntities db)
        {
            HostUrl = "/";
            UploadFolder = "Uploads";
            UploadPictureFolder = "Pic";
            UploadMediaFolder = "Media";
            UploadFileFolder = "File";
            DefaultPicture = "noimage.gif";
            RenameUploadFile = true;
            UploadFileNameFormat = "yyyyMMddhhmmssfff";
            UploadFolderNameFormat = "yyyy-MM";
            ThumbPrefix = "thumb_";
            ThumbWidth = 100;
        }
    }
}
